package com.mzd.multipledatasources3.service;

import com.mzd.multipledatasources3.bean.TeachersBean;
import com.mzd.multipledatasources3.dao.test02.TransactionDao2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Administrator
 */
@Service
public class TransactionService2 {

    @Autowired
    private TransactionDao2 ts2;

    @Transactional(rollbackFor = Exception.class)
    public boolean saveTeacher(TeachersBean t) {
        return ts2.save(t);
    }

    @Transactional(rollbackFor = Exception.class)
    public boolean saveTeacher2(TeachersBean t) {
        int i = 1 / 0;
        return ts2.save(t);
    }
}
